package com.wang.set;

import com.wang.collection.Student;

import java.util.HashSet;
import java.util.Iterator;

/**
 * hashset 集合的使用
 * 存储结构:哈希表(数组+链表+红黑树)
 */
public class HashSetDemo2 {
    public static void main(String[] args) {
        HashSet<Student> hashSet = new HashSet<>();
        Student s1 = new Student("w1",1);
        Student s2 = new Student("w2",2);
        Student s3 = new Student("w3",3);
        hashSet.add(s1);
        hashSet.add(s2);
        hashSet.add(s3);
        hashSet.add(new Student("w1",1));
        s1.hashCode();
    }
}
